#ifndef __EEExpTree_H__
#define __EEExpTree_H__

#include "EEExpMain.h"
#include "EEExpUtil.h"
#include <stdio.h>

struct node
{
	static int nextNodeID;

	node()
	{
		type = Axis::X;

		triangles = NULL;

		pLeftChild	= NULL;
		pRightChild	= NULL;
		parent = NULL;
		id = node::nextNodeID;
		node::nextNodeID++;
	}

	Axis type;
	int id;
	node* parent;
	node* pLeftChild;
	node* pRightChild;

	inline bool isLeaf()
	{
		return (pLeftChild == NULL && pRightChild == NULL && triangles != NULL);
	}

	void writeTreeStructure(FILE* pFile);
	void writeLeafData(FILE* pFile);

	std::vector<triangle>* triangles;
};

#endif